-
Notifications
You must be signed in to change notification settings - Fork 376
feat: Add copy json config button #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, I like the idea of making this more convenient. I think we should make some of this more generic though, rather than assuming we can use the Cursor format.
Another thing to take a look at is the recent support added for using a config file with inspector, mentioned here under the table: https://github.com/modelcontextprotocol/inspector?tab=readme-ov-file#configuration
I'm thinking that another way to avoid the UI edit -> partial config copy/paste process might be to edit a config file instead, and then just refer to that same config for your client and Inspector?
I think the format that's listed above matches our config file format: Suggestion![]() Our format![]()
That seems like a good plan, but I'm sure the copy and paste could still be useful. Maybe, since this gaping hole exists in the UI... ![]() ... we could put two buttons: Copy Config File and Copy Config Entry
|
@cliffhall thanks for the inputs here, appreciate the help. I too validated that most clients have same format for mcp.json , so @olaservo your query should also be resolved with that. I will go ahead and add those 2 buttons and update the PR. |
…me tooltip and optimizations.
@sumeetpardeshi Can we make the buttons take up the whole space? |
@cliffhall, now buttons take up the whole space. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sumeetpardeshi Looking good. A couple things, though.
Changes
- Add tests in Sidebar.test.tsx
- Add some explanation of this functionality in README.md.
Are we sure 'Config' is the right name here?
Since we have a Configuration
button just below these new buttons, one might think that it would copy all of those values as well, but it does not. That's because the mcp.json
files used by other clients, and our own configuration settings are two separate things. We have to disambiguate.
The easiest way to do that would be to rename these buttons.
Server Entry
& Servers File
perhaps?
@cliffhall I agree with your point of calling it
|
And a section of the README that explains what these buttons do and what the copied data is for. |
- change button names - adding unit test cases - updated landing page image - updating README file as discussed here: modelcontextprotocol#334 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few requests...
README.md
Outdated
@@ -42,6 +42,74 @@ CLIENT_PORT=8080 SERVER_PORT=9000 npx @modelcontextprotocol/inspector node build | |||
|
|||
For more details on ways to use the inspector, see the [Inspector section of the MCP docs site](https://modelcontextprotocol.io/docs/tools/inspector). For help with debugging, see the [Debugging guide](https://modelcontextprotocol.io/docs/tools/debugging). | |||
|
|||
### Configuration Export |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be best to avoid the word Configuration here because, as with the button naming, we need to disambiguate "Configuration" vs "MCP Server File", since our app's configuration is not this configuration for other apps.
### Configuration Export | |
Servers File Export |
README.md
Outdated
@@ -42,6 +42,74 @@ CLIENT_PORT=8080 SERVER_PORT=9000 npx @modelcontextprotocol/inspector node build | |||
|
|||
For more details on ways to use the inspector, see the [Inspector section of the MCP docs site](https://modelcontextprotocol.io/docs/tools/inspector). For help with debugging, see the [Debugging guide](https://modelcontextprotocol.io/docs/tools/debugging). | |||
|
|||
### Configuration Export | |||
|
|||
The MCP Inspector provides convenient buttons to export your server configuration: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MCP Inspector provides convenient buttons to export your server configuration: | |
The MCP Inspector provides convenient buttons to export server launch configurations for use in clients such as Cursor, Claude Code, or the Inspector's CLI. The file us usually called `mcp.json`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want it to be clear that the Inspector UI itself isn't currently using mcp.json
(though perhaps we should consider it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inspector does support using a JSON file as of the update to add CLI mode, so we should align the wording and naming there so they don't diverge too much: https://github.com/modelcontextprotocol/inspector/blob/main/README.md#configuration
The inspector also supports configuration files to store settings for different MCP servers. This is useful when working with multiple servers or complex configurations:
npx @modelcontextprotocol/inspector --config path/to/config.json --server everything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inspector does support using a JSON file as of the update to add CLI mode, so we should align the wording and naming there so they don't diverge too much: https://github.com/modelcontextprotocol/inspector/blob/main/README.md#configuration
The inspector also supports configuration files to store settings for different MCP servers. This is useful when working with multiple servers or complex configurations:
npx @modelcontextprotocol/inspector --config path/to/config.json --server everything
@olaservo I honestly haven't focused enough on the CLI. The file is the same format. We should consider using it on the UI as well. For now I updated the suggestion above to include the Inspector's CLI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify, UI mode can use the config file too, you just need to pass the flag like I showed in this example: #349
README.md
Outdated
@@ -93,6 +161,8 @@ Example server configuration file: | |||
} | |||
``` | |||
|
|||
> **Tip:** You can easily generate this configuration format using the **Server Entry** and **Servers File** buttons in the Inspector UI, as described in the Configuration Export section above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> **Tip:** You can easily generate this configuration format using the **Server Entry** and **Servers File** buttons in the Inspector UI, as described in the Configuration Export section above. | |
> **Tip:** You can easily generate this configuration format using the **Server Entry** and **Servers File** buttons in the Inspector UI, as described in the Servers File Export section above. |
setCopiedServerFile(false); | ||
}, 2000); | ||
}) | ||
.catch((error) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this catch necessary? It does the same thing as the catch for the surrounding try block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cliffhall idea was:
- The outer catch handles synchronous errors
- The inner catch handles asynchronous Promise rejections
if we only keep the outer catch, promise rejection from clipboard activity might not be caught in external synchronous catch. one option can be to covert inner cliboard call into await style sync and then have only single catch.
let me know what you think on this
mcp-inspector.png
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you merge main into your branch and take this screenshot again? Also, from the docs above, I gather it wasn't tested with streamableHttp, only stdio and sse. Those should be updated as well.
@cliffhall I've addressed all the suggestions mentioned above |
Added a copy config button, to copy the json config for the server currently being tested.
Motivation and Context
Currently when we are adding configs to mcp.json configuration for any client(eg. cursor), we need to manually copy the command, args and env variable. Idea is to improve UX and provide a quick copy button, which when clicked will have the config ready in clipboard to be pasted in mcp.json file. we also show a toast when the values are copied to clipboard.


this config will be copied to clipboard when testing uvx mcp-server-fetch
{ "command": "uvx", "args": [ "mcp-server-fetch" ], "env": { "YOUR_ENV_VARIABLES": "VALUE" } }
so the Idea is in an existing mcp.json file, you will add this server config from clipboard as below:
{ "mcpServers": { "your-server-name": <paste-copied-config-here> } }
How Has This Been Tested?
Tested locally by connecting to a mcp-server-fetch server

Breaking Changes
Types of changes
Checklist
Additional context